<?php

class Application_Model_DbTable_User extends Zend_Db_Table_Abstract
{

    protected $_name = 'users';

    public function authenticate($username, $password)
    {
    	$result = false;
    	
        $row = $this->fetchRow("username = '{$username}' AND password = '{$password}'");
        
        if ($row) 
        {
            $result = $row->id;
        }
        
        return $result;
    }
    
	public function getUsername($uid)
    {
    	$username = '';
    	
        $uid = (int)$uid;
        
        $row = $this->fetchRow('id = ' . $uid);
        
        if ($row) 
        {
            $username = $row->username;
        }
        
        return $username;
    }
}